import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from "element-plus/es/locale/lang/zh-cn";
import  * as Icons from '@ant-design/icons-vue';
import App from './App.vue'
import router from './router'
import mavonEditor from 'mavon-editor';
import 'mavon-editor/dist/css/index.css'

import {commonParamChange, getCommonParamObj} from "./utils/commonParamUtil.js";
import request from "./utils/request.js";
import {ElNotification} from 'element-plus'
import jsonpath from "jsonpath";
import draggable from "vuedraggable";

import ButtonComponent from "./components/lowcode/common/components/ButtonComponent.vue";
import ButtonDrawer from "./components/lowcode/common/drawer/ButtonDrawer.vue";
import SpanComponent from "./components/lowcode/common/components/SpanComponent.vue";
import SpanDrawer from "./components/lowcode/common/drawer/SpanDrawer.vue";
import TableComponent from "./components/lowcode/common/components/TableComponent.vue";
import TableDrawer from "./components/lowcode/common/drawer/TableDrawer.vue";
import PaginationComponent from "./components/lowcode/common/components/PaginationComponent.vue";
import PaginationDrawer from "./components/lowcode/common/drawer/PaginationDrawer.vue";
import TabsComponent from "./components/lowcode/common/components/TabsComponent.vue";
import TabsDrawer from "./components/lowcode/common/drawer/TabsDrawer.vue";
import AlertMessageComponent from "./components/lowcode/common/components/AlertMessageComponent.vue";
import AlertMessageDrawer from "./components/lowcode/common/drawer/AlertMessageDrawer.vue";
import PercentageComponent from "./components/lowcode/common/components/PercentageComponent.vue";
import PercentageDrawer from "./components/lowcode/common/drawer/PercentageDrawer.vue";
import DescriptionsComponent from "./components/lowcode/common/components/DescriptionsComponent.vue";
import DescriptionsDrawer from "./components/lowcode/common/drawer/DescriptionsDrawer.vue";
import CardListComponent from "./components/lowcode/card/components/CardListComponent.vue";
import CardListDrawer from "./components/lowcode/card/drawer/CardListDrawer.vue";
import CommonCardComponent from "./components/lowcode/card/components/CommonCardComponent.vue";
import CommonCardDrawer from "./components/lowcode/card/drawer/CommonCardDrawer.vue";
import GlobalFormComponent from "./components/lowcode/form/components/GlobalFormComponent.vue";
import GlobalFormDrawer from "./components/lowcode/form/drawer/GlobalFormDrawer.vue";
import DateComponent from "./components/lowcode/form/components/DateComponent.vue";
import DateDrawer from "./components/lowcode/form/drawer/DateDrawer.vue";
import InputComponent from "./components/lowcode/form/components/InputComponent.vue";
import InputDrawer from "./components/lowcode/form/drawer/InputDrawer.vue";
import InputNumberComponent from "./components/lowcode/form/components/InputNumberComponent.vue";
import InputNumberDrawer from "./components/lowcode/form/drawer/InputNumberDrawer.vue";
import SelectComponent from "./components/lowcode/form/components/SelectComponent.vue";
import SelectDrawer from "./components/lowcode/form/drawer/SelectDrawer.vue";
import DialogComponent from "./components/lowcode/feedBack/components/DialogComponent.vue";
import DialogComponentDrawer from "./components/lowcode/feedBack/drawer/DialogComponentDrawer.vue";
import DrawerComponent from "./components/lowcode/feedBack/components/DrawerComponent.vue";
import DrawerComponentDrawer from "./components/lowcode/feedBack/drawer/DrawerComponentDrawer.vue";
import AffixComponent from "./components/lowcode/navigation/components/AffixComponent.vue";
import AffixDrawer from "./components/lowcode/navigation/drawer/AffixDrawer.vue";
import BreadCrumbComponent from "./components/lowcode/navigation/components/BreadCrumbComponent.vue";
import BreadCrumbDrawer from "./components/lowcode/navigation/drawer/BreadCrumbDrawer.vue";
import MenuComponent from "./components/lowcode/navigation/components/MenuComponent.vue";
import MenuDrawer from "./components/lowcode/navigation/drawer/MenuDrawer.vue";
import MenuDropDownComponent from "./components/lowcode/navigation/components/MenuDropDownComponent.vue";
import MenuDropDownDrawer from "./components/lowcode/navigation/drawer/MenuDropDownDrawer.vue";
import VueComponentComponent from "./components/lowcode/special/components/VueComponentComponent.vue";
import VueComponentDrawer from "./components/lowcode/special/drawer/VueComponentDrawer.vue";
import VueRouterComponent from "./components/lowcode/special/components/VueRouterComponent.vue";
import VueRouterDrawer from "./components/lowcode/special/drawer/VueRouterDrawer.vue";
import LayOutComponent from "./components/lowcode/layout/components/LayOutComponent.vue";
import LayOutDrawer from "./components/lowcode/layout/drawer/LayOutDrawer.vue";
import EditableTableListComponent from "./components/lowcode/extension/components/EditableTableListComponent.vue";
import EditableTableListDrawer from "./components/lowcode/extension/drawer/EditableTableListDrawer.vue";
import MarkDownComponent from "./components/lowcode/extension/components/MarkDownComponent.vue";
import MarkDownDrawer from "./components/lowcode/extension/drawer/MarkDownDrawer.vue";
import MarkDownDirectoryComponent from "./components/lowcode/extension/components/MarkDownDirectoryComponent.vue";
import MarkDownDirectoryDrawer from "./components/lowcode/extension/drawer/MarkDownDirectoryDrawer.vue";
import MenuListComponent from "./components/lowcode/extension/components/MenuListComponent.vue";
import MenuListDrawer from "./components/lowcode/extension/drawer/MenuListDrawer.vue";
import TableSelectionSearchComponent from "./components/lowcode/extension/components/TableSelectionSearchComponent.vue";
import TableSelectionSearchDrawer from "./components/lowcode/extension/drawer/TableSelectionSearchDrawer.vue";
import VueVideoPlayComponent from "./components/lowcode/extension/components/VueVideoPlayComponent.vue";
import VueVideoPlayDrawer from "./components/lowcode/extension/drawer/VueVideoPlayDrawer.vue";
import FileUploadComponent from "./components/lowcode/file/components/FileUploadComponent.vue";
import FileUploadDrawer from "./components/lowcode/file/drawer/FileUploadDrawer.vue";
import FileUploadMultiComponent from "./components/lowcode/file/components/FileUploadMultiComponent.vue";
import FileUploadMultiDrawer from "./components/lowcode/file/drawer/FileUploadMultiDrawer.vue";
import ImageComponent from "./components/lowcode/file/components/ImageComponent.vue";
import ImageDrawer from "./components/lowcode/file/drawer/ImageDrawer.vue";
import LineChartComponent from "./components/lowcode/echarts/components/LineChartComponent.vue";
import LineChartComponentDrawer from "./components/lowcode/echarts/drawer/LineChartComponentDrawer.vue";
import RadioComponent from "@/components/lowcode/form/components/RadioComponent.vue";
import RadioDrawer from "@/components/lowcode/form/drawer/RadioDrawer.vue";
import TagComponent from "@/components/lowcode/common/components/TagComponent.vue"
import TagDrawer from "@/components/lowcode/common/drawer/TagDrawer.vue";
import DividerComponent from "@/components/lowcode/common/components/DividerComponent.vue";
import DividerDrawer from "@/components/lowcode/common/drawer/DividerDrawer.vue";
import CheckBoxComponent from "@/components/lowcode/form/components/CheckBoxComponent.vue";
import CheckBoxDrawer from "@/components/lowcode/form/drawer/CheckBoxDrawer.vue";
import AvatarDropDownComponent from "@/components/lowcode/navigation/components/AvatarDropDownComponent.vue";
import AvatarDropDownDrawer from "@/components/lowcode/navigation/drawer/AvatarDropDownDrawer.vue";
import InLineComponent from "@/components/lowcode/layout/components/InLineComponent.vue";
import InLineDrawer from "@/components/lowcode/layout/drawer/InLineDrawer.vue";
import FileViewComponent from "@/components/lowcode/file/components/FileViewComponent.vue";
import FileViewDrawer from "@/components/lowcode/file/drawer/FileViewDrawer.vue";
import RichEditorComponent from "@/components/lowcode/extension/components/RichEditorComponent.vue";
import RichEditorDrawer from "@/components/lowcode/extension/drawer/RichEditorDrawer.vue";
import TreeComponent from "@/components/lowcode/common/components/TreeComponent.vue";
import TreeDrawer from "@/components/lowcode/common/drawer/TreeDrawer.vue";
import ExternalIframeComponent from "@/components/lowcode/special/components/ExternalIframeComponent.vue";
import ExternalIframeDrawer from "@/components/lowcode/special/drawer/ExternalIframeDrawer.vue";
import YwuApprovalNode from "@/views/bpmn/flow/node/YwuApprovalNode.vue";
import YwuConditionalNode from "@/views/bpmn/flow/node/YwuConditionalNode.vue";
import YwuEndNode from "@/views/bpmn/flow/node/YwuEndNode.vue";
import YwuExecutorNode from "@/views/bpmn/flow/node/YwuExecutorNode.vue";
import YwuParallelNode from "@/views/bpmn/flow/node/YwuParallelNode.vue";
import YwuServiceNode from "@/views/bpmn/flow/node/YwuServiceNode.vue";
import YwuStartNode from "@/views/bpmn/flow/node/YwuStartNode.vue";
import BpmnShowDrawer from "@/components/lowcode/extension/drawer/BpmnShowDrawer.vue";
import BpmnShowComponent from "@/components/lowcode/extension/components/BpmnShowComponent.vue";
import SwitchComponent from "@/components/lowcode/form/components/SwitchComponent.vue";
import SwitchDrawer from "@/components/lowcode/form/drawer/SwitchDrawer.vue";


export const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(ElementPlus, {locale})
app.use(mavonEditor)

app.mount('#app')

// 挂载现有的全局组件
app.component("ButtonComponent", ButtonComponent);
app.component("ButtonDrawer", ButtonDrawer);
app.component("SpanComponent", SpanComponent);
app.component("SpanDrawer", SpanDrawer);
app.component("TagComponent", TagComponent);
app.component("TagDrawer", TagDrawer);
app.component("DividerComponent", DividerComponent);
app.component("DividerDrawer", DividerDrawer);
app.component("draggable", draggable);
app.component("TableComponent", TableComponent);
app.component("TableDrawer", TableDrawer);
app.component("PaginationComponent", PaginationComponent);
app.component("PaginationDrawer", PaginationDrawer);
app.component("TabsComponent", TabsComponent);
app.component("TabsDrawer", TabsDrawer);
app.component("AlertMessageComponent", AlertMessageComponent);
app.component("AlertMessageDrawer", AlertMessageDrawer);
app.component("PercentageComponent", PercentageComponent);
app.component("PercentageDrawer", PercentageDrawer);
app.component("DescriptionsComponent", DescriptionsComponent);
app.component("DescriptionsDrawer", DescriptionsDrawer);
app.component("CardListComponent", CardListComponent);
app.component("CardListDrawer", CardListDrawer);
app.component("CommonCardComponent", CommonCardComponent);
app.component("CommonCardDrawer", CommonCardDrawer);
app.component("GlobalFormComponent", GlobalFormComponent);
app.component("GlobalFormDrawer", GlobalFormDrawer);
app.component("DateComponent", DateComponent);
app.component("DateDrawer", DateDrawer);
app.component("InputComponent", InputComponent);
app.component("InputDrawer", InputDrawer);
app.component("InputNumberComponent", InputNumberComponent);
app.component("InputNumberDrawer", InputNumberDrawer);
app.component("SelectComponent", SelectComponent);
app.component("SelectDrawer", SelectDrawer);
app.component("RadioComponent", RadioComponent);
app.component("RadioDrawer", RadioDrawer);
app.component("CheckBoxComponent", CheckBoxComponent);
app.component("CheckBoxDrawer", CheckBoxDrawer);
app.component("DialogComponent", DialogComponent);
app.component("DialogComponentDrawer", DialogComponentDrawer);
app.component("DrawerComponent", DrawerComponent);
app.component("DrawerComponentDrawer", DrawerComponentDrawer);
app.component("AffixComponent", AffixComponent);
app.component("AffixDrawer", AffixDrawer);
app.component("AvatarDropDownComponent", AvatarDropDownComponent);
app.component("AvatarDropDownDrawer", AvatarDropDownDrawer);
app.component("BreadCrumbComponent", BreadCrumbComponent);
app.component("BreadCrumbDrawer", BreadCrumbDrawer);
app.component("MenuComponent", MenuComponent);
app.component("MenuDrawer", MenuDrawer);
app.component("MenuDropDownComponent", MenuDropDownComponent);
app.component("MenuDropDownDrawer", MenuDropDownDrawer);
app.component("VueComponentComponent", VueComponentComponent);
app.component("VueComponentDrawer", VueComponentDrawer);
app.component("VueRouterComponent", VueRouterComponent);
app.component("VueRouterDrawer", VueRouterDrawer);
app.component("LayOutComponent", LayOutComponent);
app.component("LayOutDrawer", LayOutDrawer);
app.component("EditableTableListComponent", EditableTableListComponent);
app.component("EditableTableListDrawer", EditableTableListDrawer);
app.component("MarkDownComponent", MarkDownComponent);
app.component("MarkDownDrawer", MarkDownDrawer);
app.component("MarkDownDirectoryComponent", MarkDownDirectoryComponent);
app.component("MarkDownDirectoryDrawer", MarkDownDirectoryDrawer);
app.component("MenuListComponent", MenuListComponent);
app.component("MenuListDrawer", MenuListDrawer);
app.component("TableSelectionSearchComponent", TableSelectionSearchComponent);
app.component("TableSelectionSearchDrawer", TableSelectionSearchDrawer);
app.component("VueVideoPlayComponent", VueVideoPlayComponent);
app.component("VueVideoPlayDrawer", VueVideoPlayDrawer);
app.component("RichEditorComponent", RichEditorComponent);
app.component("RichEditorDrawer", RichEditorDrawer);
app.component("FileUploadComponent", FileUploadComponent);
app.component("FileUploadDrawer", FileUploadDrawer);
app.component("FileUploadMultiComponent", FileUploadMultiComponent);
app.component("FileUploadMultiDrawer", FileUploadMultiDrawer);
app.component("ImageComponent", ImageComponent);
app.component("ImageDrawer", ImageDrawer);
app.component("FileViewComponent", FileViewComponent);
app.component("FileViewDrawer", FileViewDrawer);
app.component("LineChartComponent", LineChartComponent);
app.component("LineChartComponentDrawer", LineChartComponentDrawer);
app.component("InLineComponent", InLineComponent);
app.component("InLineDrawer", InLineDrawer);
app.component("TreeComponent", TreeComponent);
app.component("TreeDrawer", TreeDrawer);
app.component("ExternalIframeComponent", ExternalIframeComponent);
app.component("ExternalIframeDrawer", ExternalIframeDrawer);
app.component("BpmnShowDrawer", BpmnShowDrawer);
app.component("BpmnShowComponent", BpmnShowComponent);
app.component("SwitchComponent", SwitchComponent);
app.component("SwitchDrawer", SwitchDrawer);

// 流程节点组件
app.component("YwuApprovalNode", YwuApprovalNode);
app.component("YwuConditionalNode", YwuConditionalNode);
app.component("YwuEndNode", YwuEndNode);
app.component("YwuExecutorNode", YwuExecutorNode);
app.component("YwuParallelNode", YwuParallelNode);
app.component("YwuServiceNode", YwuServiceNode);
app.component("YwuStartNode", YwuStartNode);


// 插入所有图标组件
Object.keys(Icons).forEach((key)=>{
    app.component(key, Icons[key as keyof typeof Icons])
})

// 初始化所有低码扩展内容
app.config.globalProperties.$commonParamChange = commonParamChange;
app.config.globalProperties.$getCommonParamObj = getCommonParamObj;
app.config.globalProperties.$request = request;
app.config.globalProperties.$ElNotification = ElNotification;
app.config.globalProperties.$window = window;
app.config.globalProperties.$jsonpath = jsonpath;
